//
//  HRWebService.h
//  haierapp
//
//  Created by Xia Zhiyong on 14-8-21.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <JSONModel.h>
#import "HRResultModel.h"


//操作成功（网络请求成功，返回值Success = true,两个条件同时成立，才会回调该方法）
typedef void (^RequestSuccessBlock)(AFHTTPRequestOperation *operation, HRResultModel *result);
//操作失败（网络原因的失败，或者返回值Success != true则执行下面的回调）
typedef void (^RequestFailureBlock)(AFHTTPRequestOperation *operation, NSError *error);

@interface HRWebService : NSObject


+(void)startRequest:(NSString*)action body:(NSString*)body returnClass:(Class)returnClass
            success:(RequestSuccessBlock)sBlock
            failure:(RequestFailureBlock)fBlock;

+ (HRResultModel *)getResultWithString:(NSString *)responseObj
                         returnClass:(Class)returnClass
                            andError:(NSError**)err;
@end
